# -*- coding: utf-8 -*-
# @Author : HaleShi
# @Time : 2023-06-15
# @File : 5_hook_native_getNavInfo.py


import frida
import sys

str_host = "127.0.0.1:8877"
manager = frida.get_device_manager()
rdev = manager.add_remote_device(str_host)
session = rdev.attach("唯品会")

scr = """
Java.perform(function () {

    var KeyInfo = Java.use("com.vip.vcsp.KeyInfo");
    KeyInfo.getInfo.implementation = function(context, str){
        console.log("——————————————————————请求来了——————————————————————");
        console.log("----------这是context:",context);
        console.log("----------这是str:",str);
        var res = this.getNavInfo(context, str)
        console.log("----------这是返回值:",res)
        return res;
    };


});
"""

script = session.create_script(scr)


def on_message(message, data):
    print(message, data)


script.on("message", on_message)

script.load()
sys.stdin.read()